//
//  LPTabBarController.m
//  彩票
//
//  Created by liupan on 2016/11/25.
//  Copyright © 2016年 liupan. All rights reserved.
//

#import "LPTabBarController.h"
#import "LPAreenaController.h"
#import "LPDiscoverController.h"
#import "LPHallTableController.h"
#import "LPMyLotteryController.h"
#import "LPHistoryController.h"
#import "LPTabBar.h"
#import "LPNavController.h"
#import "LPAreenaNavController.h"
#import "NSDictionary+Property.h"
@interface LPTabBarController ()

@end

@implementation LPTabBarController

- (void)viewDidLoad {
    [super viewDidLoad];
    //1.添加子控制器
    [self setupAllChildViewControl];
    //2.更换系统TabBar
    [self setValue:[[LPTabBar alloc]init] forKey:@"tabBar"];
}
- (void)setupAllChildViewControl{
    //购彩大厅
    [self setupChildViewController:[[LPHallTableController alloc]init] image:@"TabBar_LotteryHall_new" selectImage:@"TabBar_LotteryHall_selected_new"];
    //竞技场
    [self setupChildViewController:[[LPAreenaController alloc]init] image:@"TabBar_Arena_new" selectImage:@"TabBar_Arena_selected_new"];
    //发现
    [self setupChildViewController:[[LPDiscoverController alloc]init] image:@"TabBar_Discovery_new" selectImage:@"TabBar_Discovery_selected_new"];
    //开奖信息
    [self setupChildViewController:[[LPHistoryController alloc]init] image:@"TabBar_History_new" selectImage:@"TabBar_History_selected_new"];
    //我的彩票
    [self setupChildViewController:[[LPMyLotteryController alloc]init] image:@"TabBar_MyLottery_new" selectImage:@"TabBar_MyLottery_selected_new"];
    
    /****************    KCV自动生成成员属性    ******************/
    //记载plist
//    NSString *path = [[NSBundle mainBundle] pathForResource:@"deals.plist" ofType:nil ];
//    //文件全路径
//    NSDictionary *dictionary = [NSDictionary dictionaryWithContentsOfFile:path];
//    [dictionary createPropertyCode];
//    
    
}
//初始化一个控制器
- (void)setupChildViewController:(UIViewController *)vc image:(NSString *)image selectImage:(NSString *)selectImage{
    //设置图片不被渲染
    vc.tabBarItem.image=[UIImage imageWithOriginalRenderingimage:image];
    //设置选中图片不被渲染
    vc.tabBarItem.selectedImage=[UIImage imageWithOriginalRenderingimage:selectImage];
    //包装导航控制器
    //1.创建导航控制器
    UINavigationController *nav=[[LPNavController alloc]initWithRootViewController:vc];
    if ([vc isKindOfClass:[LPAreenaController class]]) {
        nav = [[LPAreenaNavController alloc]initWithRootViewController:vc];
    }
    [self addChildViewController:nav];
}
@end
